#region BLL VERSION  2.6
/* NhanVien
 *
 * Author: LANNT    
 * Copyright: (c) - LANNT 
 * Created:   08/09/2012 8:31:19 AM
 * Last modify: 2012-08-01 11:15 PM 
 * Note   :   Changes to this file may cause incorrect behavior and will be lost if
*            the code is regenerated.
*/
#endregion

#region Using directives
using System;
using System.Collections;
using System.Collections.Generic;
using GQ.Utils;

using Chili.Opf3;
using Chili.Opf3.Relations;
using Chili.Opf3.DynamicProperties;
#endregion

namespace GQ.BLL.QuanLyKho
{
	#region NhanVien
	[Serializable]
	[Persistent("NHANVIEN", PoolSize = 10)]
	public partial class NhanVien 
	{
		#region Members
		private Guid _id=Guid.NewGuid();
		private string _ma=null;
		private string _ten=null;
		private bool? _gioitinh=null;
		private DateTime? _ngaysinh=null;
		private string _masothue=null;
		private Guid? _phongbanid=null;
		private string _cmndso=null;
		private DateTime? _cmndngaycap=null;
		private string _cmndnoicap=null;
		private string _nganhangtaikhoan=null;
		private string _nganhangten=null;
		private string _diachi=null;
		private string _dienthoaicoquan=null;
		private string _dienthoainharieng=null;
		private string _dienthoaididong=null;
		private string _email=null;
		private string _chucvu=null;
		#endregion
		
		#region Public Properties
		
		[Field("ID", Identifier=true, AllowDBNull=false)]
		public Guid ID
		{
			get{ return _id; }
			set{ _id = value; }
		}
		
		[Field("MA")]
		public string Ma
		{
			get{ return _ma; }
			set{ _ma = value; }
		}
		
		[Field("TEN")]
		public string Ten
		{
			get{ return _ten; }
			set{ _ten = value; }
		}
		
		[Field("GIOITINH")]
		public bool? GioiTinh
		{
			get{ return _gioitinh; }
			set{ _gioitinh = value; }
		}
		
		[Field("NGAYSINH")]
		public DateTime? NgaySinh
		{
			get{ return _ngaysinh; }
			set{ _ngaysinh = value; }
		}
		
		[Field("MASOTHUE")]
		public string MaSoThue
		{
			get{ return _masothue; }
			set{ _masothue = value; }
		}
		
		[Field("PHONGBANID")]
		public Guid? PhongBanID
		{
			get{ return _phongbanid; }
			set{ _phongbanid = value; }
		}
		
		[Field("CMNDSO")]
		public string CMNDSo
		{
			get{ return _cmndso; }
			set{ _cmndso = value; }
		}
		
		[Field("CMNDNGAYCAP")]
		public DateTime? CMNDNgayCap
		{
			get{ return _cmndngaycap; }
			set{ _cmndngaycap = value; }
		}
		
		[Field("CMNDNOICAP")]
		public string CMNDNoiCap
		{
			get{ return _cmndnoicap; }
			set{ _cmndnoicap = value; }
		}
		
		[Field("NGANHANGTAIKHOAN")]
		public string NganHangTaiKhoan
		{
			get{ return _nganhangtaikhoan; }
			set{ _nganhangtaikhoan = value; }
		}
		
		[Field("NGANHANGTEN")]
		public string NganHangTen
		{
			get{ return _nganhangten; }
			set{ _nganhangten = value; }
		}
		
		[Field("DIACHI")]
		public string DiaChi
		{
			get{ return _diachi; }
			set{ _diachi = value; }
		}
		
		[Field("DIENTHOAICOQUAN")]
		public string DienThoaiCoQuan
		{
			get{ return _dienthoaicoquan; }
			set{ _dienthoaicoquan = value; }
		}
		
		[Field("DIENTHOAINHARIENG")]
		public string DienThoaiNhaRieng
		{
			get{ return _dienthoainharieng; }
			set{ _dienthoainharieng = value; }
		}
		
		[Field("DIENTHOAIDIDONG")]
		public string DienThoaiDiDong
		{
			get{ return _dienthoaididong; }
			set{ _dienthoaididong = value; }
		}
		
		[Field("EMAIL")]
		public string Email
		{
			get{ return _email; }
			set{ _email = value; }
		}
		
		[Field("CHUCVU")]
		public string ChucVu
		{
			get{ return _chucvu; }
			set{ _chucvu = value; }
		}
		
		#endregion
		#region Methods Install
		public NhanVien LoadByID()
		{
		   return DbContext.ObjectContext.GetObject<NhanVien>("ID={0}",ID);
		}
		public static NhanVien LoadByID(Guid id)
		{
		   return DbContext.ObjectContext.GetObject<NhanVien>("ID={0}",id);
		}
		public void DeleteByID(Guid id)
		{
		   ID=id;
		   Chili.Opf3.ObjectInfo  objInfo= GQ.Utils.DbContext.ObjectContext.GetObjectInfo(this);
			  objInfo.ObjectState = Chili.Opf3.ObjectStates.Loaded;
			  objInfo.MarkForDeletion = true;
		   DbContext.ObjectContext.PersistChanges<NhanVien>(this);
		}
		public NhanVien LoadBy(string conditions, params object[] parameter)
		{
		   return DbContext.ObjectContext.GetObject<NhanVien>(conditions, parameter);
		}
		public void Save()
		{
		   DbContext.ObjectContext.PersistChanges<NhanVien>(this);
		}
		public void Delete()
		{
			 DbContext.ObjectContext.MarkForDeletion(this);
		   DbContext.ObjectContext.PersistChanges<NhanVien>(this);
		}
		#endregion Methods Install
		#region Methods Collection
		public static IList<NhanVien> LoadAll()
		{
		   return DbContext.ObjectContext.GetObjectSet<NhanVien>();
		}
		public static IList<NhanVien> LoadAll(string sortby)
		{
		   return DbContext.ObjectContext.GetObjectSet<NhanVien>("Sortby " + sortby);
		}
		public static IList<NhanVien> LoadAllBy(string conditions, params object[] parameter)
		{
		   return DbContext.ObjectContext.GetObjectSet<NhanVien>(conditions, parameter);
		}
		public static IList<NhanVien> LoadAllBy(Chili.Opf3.Query.SqlQuery query)
		{
		   return DbContext.ObjectContext.GetObjectSet<NhanVien>(query);
		}
		public static void SaveAll(IList<NhanVien> collection)
		{
		   foreach (NhanVien item in collection)
		   {
		       item.Save();
		   }
		}
		public static void DeleteAll(IList<NhanVien> collection)
		{
			foreach (NhanVien item in collection)
			{
		 		item.Delete();
			}
		}
		#endregion Methods Collection

	}
	#endregion
	
}
